<%@ page contentType="text/html; charset=GBK"  %>
<%@page import="java.util.*"%>
<%@page import="com.ionglobal.db.*" %>
<%@page import="com.ionglobal.misc.*" %>
<%@page import="com.ionglobal.lib.*" %>
<%@page import="com.gzgi.weqs.refquote.*" %>
<%@page import="com.gzgi.weqs.partsmanage.*" %>
<%@ include file="/include/init_include.jsp" %>
<%
	Sysop me = (Sysop)session.getAttribute("sysop");
	String reqname = Request.getString("reqname","");
	String parttype = Request.getString("parttype","");
	String reqtype = Request.getString("reqtype","");
	String mcode = Request.getString("mcode","").toUpperCase();
	Date criteriondate = Request.getDate("criteriondate",null);
	String spcode = Request.getString("spcode","");
	String partno = Request.getString("partno","");
	int exchangeid = Request.getInt("exchangeid",0);
	Date parteffectdate = Request.getDate("parteffectdate",null);
	Date requiredate = Request.getDate("requiredate",null);
	
	Req req = new Req();
	req.setReqName(reqname);
	req.setReqType(reqtype);
	req.setStatus(10);
	req.setCreator(me.getName());
	req.setPartType(parttype);
	req.setExchangeId(exchangeid);
	req.setCriterionDate(criteriondate);
	req.setPartEffectDate(parteffectdate);
	req.setRequireDate(requiredate);
	
	session.setAttribute("ReqBuild", req);
	
	if(parttype.equals("MP")){
		Map wherecause = new HashMap();
		if(mcode.length()>0)
			wherecause.put("mcode", mcode);
		if(criteriondate!=null)
			wherecause.put("criteriondate", criteriondate);
		if(spcode.length()>0)
			wherecause.put("spcode", spcode);
		else
			wherecause.put("sysop", me);
		if(partno.length()>0)
			wherecause.put("partno", partno);
		PartsManageItemApp pmiApp = new PartsManageItemApp();
		String jsonStr = pmiApp.buildData(dbi, wherecause);
		session.setAttribute("ReqBuildData", jsonStr);
		session.setAttribute("ReqBuildMap", wherecause);
		out.print(jsonStr);
	}
%>
<%@ include file="/include/init_free.jsp" %>